package com.jesper.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jesper.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select(" SELECT * from tb_user  where userName = #{userName, jdbcType=VARCHAR} and password = #{password, jdbcType=VARCHAR} and state = 1")
    User selectByNameAndPwd(User user);


    @Select(" SELECT 1 from tb_user  where userName = #{userName, jdbcType=VARCHAR}")
    int selectIsName(User user);

    @Select("SELECT password from tb_user  where userName = #{userName, jdbcType=VARCHAR} AND  email = #{email, jdbcType=VARCHAR}")
    String selectPasswordByName(User user);

    @Select("SELECT password from tb_user  where userName = #{userName, jdbcType=VARCHAR} ")
    String selectPasswordByName1(String username);

    @Select("select role_id from tb_user where userName = #{userName}")
    Integer getRoleByName(String username);


}
